import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../common/colors.dart';
import 'news_detail_comment_model.dart';
class NewsCommenDetailPage extends StatefulWidget {


  NewsDetailCommentItemModel? _model;

  NewsCommenDetailPage(this._model);



  @override
  State<NewsCommenDetailPage> createState() => _NewsCommenDetailPageState();
}

class _NewsCommenDetailPageState extends State<NewsCommenDetailPage> {
  @override
  Widget build(BuildContext context) {
    return Container(

      height:Get.height -50 ,
      decoration:BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.all(Radius.circular(12.0)),

      ),
      child: Column(
        children: [
          SizedBox(height: 0,),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text('             '),
              Text('评论详情',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 15),),
              IconButton(onPressed: (){
                Get.back();
              }, icon: Icon(Icons.close,color: Colors.grey,)),
            ],
          ),
          Expanded(child: ListView.builder(itemBuilder: (BuildContext context, int index) {

            // if(index == 0){
            //   return Container(
            //     child: Column(
            //       crossAxisAlignment: CrossAxisAlignment.start,
            //       children: [
            //         Container(
            //           margin: EdgeInsets.only(left: 15,right: 15,top: 15),
            //           child: Text('${widget._model!.author}',style: TextStyle(fontSize: 13,fontWeight: FontWeight.w500),),
            //         ),
            //         Container(
            //           width: Get.width-30,
            //           margin: EdgeInsets.only(left: 15,right: 15,top: 10),
            //           child: Text('${widget._model!.comment}',style: TextStyle(fontSize: 13,),),
            //         ),
            //         Container(
            //           margin: EdgeInsets.only(left: 15,right: 15,top: 10),
            //           child: Text('${widget._model!.dateBeauty}',style: TextStyle(fontSize: 10,color: Colors.grey),),
            //         ),
            //         Container(
            //           margin: EdgeInsets.only(left: 15,right: 15,top: 25),
            //           color: AppColor.lineColor,
            //           height: 0.5,
            //           width: Get.width,
            //         ),
            //
            //         Container(
            //           margin: EdgeInsets.only(left: 15,right: 15,top: 15),
            //           child: Text('全部回复 ${widget._model!.commentNums}',
            //             style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14),),
            //         )
            //       ],
            //     ),
            //   );
            // }
            return Container(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                 index==0?Container(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Container(
                          margin: EdgeInsets.only(left: 15,right: 15,top: 15),
                          child: Text('${widget._model!.author}',style: TextStyle(fontSize: 13,fontWeight: FontWeight.w500),),
                        ),
                        Container(
                          width: Get.width-30,
                          margin: EdgeInsets.only(left: 15,right: 15,top: 10),
                          child: Text('${widget._model!.comment}',style: TextStyle(fontSize: 13,),),
                        ),
                        Container(
                          margin: EdgeInsets.only(left: 15,right: 15,top: 10),
                          child: Text('${widget._model!.dateBeauty}',style: TextStyle(fontSize: 10,color: Colors.grey),),
                        ),
                        Container(
                          margin: EdgeInsets.only(left: 15,right: 15,top: 25),
                          color: AppColor.lineColor,
                          height: 0.5,
                          width: Get.width,
                        ),

                        Container(
                          margin: EdgeInsets.only(left: 15,right: 15,top: 15),
                          child: Text('全部回复 ${widget._model!.commentNums}',
                            style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14),),
                        )
                      ],
                    ),
                  ):Container(),

                  Container(
                    margin: EdgeInsets.only(left: 15,right: 15,top: 25),
                    child: Text('${widget._model!.children![index]['author']}',style: TextStyle(fontSize: 13,fontWeight: FontWeight.w500),),
                  ),
                  Container(
                    width: Get.width-30,
                    margin: EdgeInsets.only(left: 15,right: 15,top: 10),
                    child: Text('${widget._model!.children![index]['comment']}',style: TextStyle(fontSize: 13,),),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 15,right: 15,top: 10),
                    child: Text('${widget._model!.children![index]['date_beauty']}',style: TextStyle(fontSize: 10,color: Colors.grey),),
                  ),
                ],
              ),
            );
          },itemCount: widget._model!.children!.length,)),

        ],
      ),
    );
  }
}
